package com.bi.student.dubbo.consumers.mock;

import com.bi.sampleapi.DubboStudentApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @description:
 * @author: 朱超
 * @createDate: 2024/2/27
 * @version: 1.0
 * @remark：备注
 */
@Slf4j
public class DubboStudentApiServiceMock implements DubboStudentApiService {

    private void log(String path) {
        ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = requestAttributes.getRequest();
        StringBuffer url = request.getRequestURL();
        log.info("服务熔断---【{}】>>>" + url, path);
    }


    @Override
    public int getActivity() {
        this.log("getActivity");
        return 0;
    }
}
